package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInDeductionStatApplyResult;
import com.ims.core.doc.service.ITInDeductionStatApplyResultService;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 统计表申请结果Controller
 *
 * @author IMS
 * @date 2024-12-11
 */
@RestController
@RequestMapping("/doc/indeductionatatapplyresult")
public class TInDeductionStatApplyResultController extends BaseController
{
    @Autowired
    private ITInDeductionStatApplyResultService tInDeductionStatApplyResultService;

    /**
     * 查询统计表申请结果列表
     */
    @PreAuthorize("@ss.hasPermi('doc:indeductionatatapplyresult:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInDeductionStatApplyResult tInDeductionStatApplyResult)
    {
        startPage();
        List<TInDeductionStatApplyResult> list = tInDeductionStatApplyResultService.selectTInDeductionStatApplyResultList(tInDeductionStatApplyResult);
        return getDataTable(list);
    }

    /**
     * 导出统计表申请结果列表
     */
    @PreAuthorize("@ss.hasPermi('doc:indeductionatatapplyresult:export')")
    @Log(title = "统计表申请结果", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInDeductionStatApplyResult tInDeductionStatApplyResult)
    {
        List<TInDeductionStatApplyResult> list = tInDeductionStatApplyResultService.selectTInDeductionStatApplyResultList(tInDeductionStatApplyResult);
        ExcelUtil<TInDeductionStatApplyResult> util = new ExcelUtil<TInDeductionStatApplyResult>(TInDeductionStatApplyResult.class);
        util.exportExcel(response, list, "统计表申请结果数据");
    }

    /**
     * 获取统计表申请结果详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:indeductionatatapplyresult:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInDeductionStatApplyResultService.selectTInDeductionStatApplyResultById(id));
    }

    /**
     * 新增统计表申请结果
     */
    @PreAuthorize("@ss.hasPermi('doc:indeductionatatapplyresult:add')")
    @Log(title = "统计表申请结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInDeductionStatApplyResult tInDeductionStatApplyResult)
    {
        return toAjax(tInDeductionStatApplyResultService.insertTInDeductionStatApplyResult(tInDeductionStatApplyResult));
    }

    /**
     * 修改统计表申请结果
     */
    @PreAuthorize("@ss.hasPermi('doc:indeductionatatapplyresult:edit')")
    @Log(title = "统计表申请结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInDeductionStatApplyResult tInDeductionStatApplyResult)
    {
        return toAjax(tInDeductionStatApplyResultService.updateTInDeductionStatApplyResult(tInDeductionStatApplyResult));
    }

    /**
     * 删除统计表申请结果
     */
    @PreAuthorize("@ss.hasPermi('doc:indeductionatatapplyresult:remove')")
    @Log(title = "统计表申请结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInDeductionStatApplyResultService.deleteTInDeductionStatApplyResultByIds(ids));
    }
}
